<?php
	include "../utils/_connection.php";
	$var = conectar();
	session_start();
	$id = $_SESSION['id'];
	$query = "SELECT id_article, status, title FROM articles where id_author = $id";
	$res = mysql_query($query);
?>

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="">
	<meta name="author" content="">
	<title>Consola: Estado</title>

	<!-- Le styles -->
	<script type="text/javascript" src="../js/tinymce/tinymce.min.js"></script>
	<script type="text/javascript">
		tinymce.init({
			mode : "specific_textareas",
			editor_selector : "mceEditor",
			plugins: "table, code, image, jbimages",
			content_css: "css/content.css",
			invalid_elements: "span",
    //encoding: "xml",
    apply_source_formatting : true,
    relative_urls: 'false'
});
	</script>

	<script>
	    function submitForm(action)
	    {
	        document.getElementById('Form').action = action;
	        document.getElementById('Form').submit();
	    }
	</script>


	<link href="../css/bootstrap.css" rel="stylesheet">
	<style type="text/css">
		body {
			padding-top: 60px;
			padding-bottom: 40px;
		}
		.sidebar-nav {
			padding: 9px 0;
		}

		@media (max-width: 980px) {
			/* Enable use of floated navbar text */
			.navbar-text.pull-right {
				float: none;
				padding-left: 5px;
				padding-right: 5px;
			}
		}
	</style>

</head>

<body>

	<?php
	include 'include/header.php';
	?>

	<div class="container">
		<?php
			include 'include/side.php';
		?>

		<div class="col-sm-9">
			<div class="hero-unit">
				<table class="table table-striped table bordered">
					<thead>
						<tr>
							<th class="col-sm-1"> ID </th>
							<th class="col-sm-6"> Titulo </th>
							<th class="col-sm-1"> Estado </th>
							<th> Acciones </th>
						</tr>
					</thead>
					<tbody>
					
					<?php 
						while ($obj = mysql_fetch_object($res)) {
							echo "<tr>";
							echo "<td>".$obj->id_article."</td>";
							echo "<td>".$obj->title."</td>";
							echo "<td>".$obj->status."</td>";
							echo "<td>";
							?> 
							<a href="article_edit.php?id=<?php echo $obj->id_article;?>">
								<button class="btn btn-primary btn-sm"> Editar Articulo </button>
							</a>
							<a href="article_check.php?id=<?php echo $obj->id_article;?>">
								<button class="btn btn-danger btn-sm"> Revisar Comentarios </button>
							</a>
							<?php 
							echo "</td>";
							echo "</tr>";
						}
					?>
					
					</tbody>
				</table>
			</div>
		</div>


	</div><!--/row-->

	<!--Le Separator -->
	<hr>

	<?php
	include 'include/footer.php';
	?>	

</div><!--/.fluid-container-->

<?php
include 'include/scripts.php';
?>

</body>
</html>
